package cn.kpt.auth.service.impl;

import cn.kpt.auth.service.MailService;
import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @version 1.0
 * @ClassName MailServiceImpl
 * @Description TODO
 * @Author kangpengtao
 * @Date 2019/9/29 13:31
 */
@Service
public class MailServiceImpl implements MailService {

    @Resource
    private MailSender mailSender;
    @Resource
    private SimpleMailMessage mailMessage;
    @Override
    public void sendActivationMail(String mailTo, String activationCode) throws Exception {
        mailMessage.setTo(mailTo);
        mailMessage.setText("您的注册邮箱："+mailTo+"激活码："+activationCode);
        mailSender.send(mailMessage);
    }
}
